using UnityEngine;

public class AnimatorWalkEnabler : MonoBehaviour
{
	private Animator _animator;

	public bool walk = true;

	public AnimatorOverrideController overrideController;

	[Range(0f, 1f)]
	public float blend;

	private void Awake()
	{
		_animator = GetComponent<Animator>();
		if (overrideController != null)
		{
			_animator.runtimeAnimatorController = overrideController;
		}
		if (_animator.layerCount > 1)
		{
			_animator.SetLayerWeight(1, 1f);
		}
	}

	private void OnEnable()
	{
		if (_animator != null)
		{
			_animator.SetFloat("SpeedStraight", blend);
			_animator.SetBool("IsMoving", walk);
		}
	}
}
